
<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="renderer" content="webkit"> 
	<meta content="always" name="referrer">
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>个人设置</title>
    <!--[if lt IE 9]>
			<script type="text/javascript">
				window.location.href = "tip.html"
			</script>
		<![endif]-->
    <link rel="stylesheet" href="css/style.css">
    <link rel="stylesheet" href="css/zhanghu.css">
    <script src="js/jquery.min.js"></script>
    <script src="lib/layui/layui.js" type="text/javascript" charset="utf-8"></script>
    <style>
        .header{height: 42px;line-height: 42px;background: #FFFFFF;font-size:12px;border-bottom:1px solid #ffd7c0}
        .header .w_1190{position: relative;width: 1190px;margin: 0 auto;}
        .header .w_1190 .h_left b{position: absolute; top:50%; margin-top: -9px; margin-right: 5px; width: 20px;height: 16px; }
        .header .w_1190 .h_left b ul{position: absolute}
        .header .w_1190 .bhover{min-width: 200px;z-index:9999; height: 70px; background-color: #fff;position: absolute; top: 20px; left: -45px; border-radius: 4px;padding: 10px;box-shadow: 0 0 5px #f1f1f1;}
        .header .w_1190 .bhover span:last-child{color: #f40;font-size: 21px;font-weight: 700; margin:0 3px;}
        .header .w_1190 .bhover li{height: 22px;line-height: 22px;}
        .header .h_left a.c_01afff {color: #ff6002;margin-right:60px;}
        .header .h_right a {margin-left: 40px;color: #4a4a4a;}
    </style>
    <style>
		#userName{
			float: left;
			width: 75px;
			text-align: center;
			position: relative;
			cursor: pointer;
			display: none;
		}
		#userName dl{
			top: 42px;
			width: 100%;
			position: absolute;
			display: none;
			background: #fff;
			z-index: 9999;
		}
		.main-container .right-cont .title{
			position: relative;
		}
		.btnList{
			position: absolute;
			top: 50px;
			right: 15px;
		}
		.btnList a{
			float: left;
	        margin-right: 20px;
	        line-height: 40px;
	        border: 1px solid #d2d2d2;
	        border-radius: 20px;
	        width: 80px;
	        text-align: center;
	        cursor: pointer;
		}
	</style>
</head>
<body>


<div class="header">
	<div class="w_1190">
		<div class="h_right fr">
			<a href="index.html">YIXA首页</a>
			<a href="dingdan.html">我的订单</a>
			<a href="zhanghu.html">账户设置</a>
			<a href="about.html">关于我们</a>
		</div>
		<div class="h_left">
			<ul id="userName">
				<li></li>
				<dl>
					<dd>退出登录</dd>
				</dl>
			</ul>
			<!-- 未登录 -->
				<a href="login.html" class="c_01afff" id="login">登录</a>
				<a href="register.html" class="registerno">免费注册</a>
			<!-- 已登录 -->
		</div>
	</div>
</div>
<script type="text/javascript">
	layui.use(['layer'], function() {
        var layer = layui.layer;
	
	$("#userName").on("click",function(){
	    $(this).find("dl").slideToggle(200)
	})
	
	$("#userName dd").on("click",function(){
	    $.ajax({
	    	type:"post",
	    	url:"http://52lvu.cn:8080/api/login/logout",
	        data:{
	            userId : token.userId
	        },success : function (result){
	            
	            if (result.resultCode == 200) {
	            	localStorage.removeItem("token");
	            	window.location.href="login.html"
	            }
	            
	        },error : function (e){
	            layer.msg("登出失败！请稍候重试",{icon:2,time:3000});
	        }
	    });
	})
	
	var token = JSON.parse(localStorage.getItem('token'));
	
	if (token) {
		var expiredTime = 1800000;
		var loginTime = token.loginTime
		var nowTime = new Date().getTime();
		
		if ( (nowTime - loginTime) > expiredTime ) {
			localStorage.removeItem("token");
			window.location.href = "login.html";
		}else{
			$("#userName").show(); 
			$(".registerno").hide();
			$("#login").hide()
			$("#userName li").html(token.userName)
		}
	}else{
	    window.location.href="login.html";
	}
	})
</script>

<div class="main-container w-1200 clearfloat">
    <div class="left-cont">
        <ul class="leftNav">
            <li class="active"><a href="zhanghu.html">个人设置</a></li>
            <li><a href="safety.html">安全中心</a></li>
            <!--<li><a href="set.html">消息中心</a></li>-->
        </ul>
    </div>
    <div class="right-cont">
        <ul class="title">
            <li class="tit">个人信息</li>
            <li class="desc">账户设置</li>
            
            <!--<div class="btnList">
            	<a class="xg">修改</a>
            	<a class="qd">确定</a>
            </div>-->
            
            
        </ul>
        <ul class="lift">
            <li class="fl">旅行社名称</li>
            <li class="fr"></li>
        </ul>
        <ul class="lift">
            <li class="fl">真实姓名</li>
            <li class="fr"></li>
        </ul>
        <ul class="lift">
            <li class="fl">手机号</li>
            <li class="fr"></li>
        </ul>
        <ul class="lift">
            <li class="fl">旅行社部门及职位</li>
            <li class="fr"></li>
        </ul>
        <ul class="lift">
            <li class="fl">旅行社认证审核</li>
            <li class="fr"></li>
        </ul>
    </div>
</div>


<div id="footer"></div>

</body>
</html>
<script src="js/ajaxSet.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
	
layui.use(['layer'], function() {
    var layer = layui.layer;
	
	var token = JSON.parse(localStorage.getItem('token'));
	 $("#qq").load("lib/qq.html");$("#footer").load("lib/footer.html");
	$.ajax({
	    type:"post",
	    url:"http://52lvu.cn:8080/api/user/userInfo",
	    data:{
	        userId : token.id,
	        token : token.token
	    },success : function (result){
	        var data = result.data ;
			$(".right-cont .lift .fr").eq(0).html(data.name);
			$(".right-cont .lift .fr").eq(1).html(data.userName);
			$(".right-cont .lift .fr").eq(2).html(data.phone);
			$(".right-cont .lift .fr").eq(3).html(data.job);
			
			if (result.data.state == 0) {
				$(".right-cont .lift .fr").eq(4).html("未审核")
			} else{
				$(".right-cont .lift .fr").eq(4).html("审核成功")
			}
			
	    },error : function (e){
	        layer.msg("请求错误，请稍后重试",{icon:2,time:2000})
	    }
	});
	
	
//	$(".xg").on("click",function(){
//	    for (i = 0 ; i < $(".lift").length-1 ; i++) {
//	    	var str = $(".lift").eq(i).find(".fr").html();
//	    	$(".lift").eq(i).find(".fr").empty().append("<input type='text' value='"+str+"'/>")
//	    }
//	    $(this).unbind();
//	    $(".qd").on("click",function(){
//	        qd()
//	    })
//	})
	
//	function qd(){
//		$.ajax({
//	        type:"post",
//	        url:"http://52lvu.cn:8080/api/user/updateUserInfo",
//	        data:{
//	            userId : token.id,
//	            token : token.token ,
//	            name : $(".right-cont .lift .fr").eq(0).find("input").val(),
//	            userName : $(".right-cont .lift .fr").eq(1).find("input").val(),
//	            phone : $(".right-cont .lift .fr").eq(2).find("input").val(),
//	            job : $(".right-cont .lift .fr").eq(3).find("input").val()
//	        },success : function (result){
//	        	if(){
//	        		layer.msg("修改成功！即将刷新页面",{icon:1,time:3000});
//	        	}
//	   			else if (result.resultCode == "104"){
//		        	layer.msg("登录超时，请重新登录",{icon:2,time:2000})
//		        }
//	        },error : function (e){
//	            layer.msg("请求错误！请稍候重试",{icon:2,time:3000});
//	        }
//	    });
//	}
})
	
</script>